| API Documentation |  |

- MAIN PAGE
- NAMESPACES
- CLASSES

Shader.h
1 // Shader.h
3 //
5
6 namespace nkGraphics
7 {
15 class Shader : public Resource, public nkExport::Exportable
16 {
17 public :
18
22 virtual ~Shader () ;
23
24 // Getters
28 unsigned int getId () const ;
32 bool isUsableScene () const ;
36 bool isUsablePostProcess () const ;
40 bool isUsableCompute () const ;
44 bool isUsableGeometry () const ;
48 bool isUsableRaytracing () const ;
52 Program* getProgram () const ;
56 unsigned int getMaxInstancePerBuffer () const ;
60 bool getIsBuiltInShader () const ;
64 bool getDirtyInstanceData () const ;
65
66 // Setters
70 virtual void setProgram (Program* prog) ;
74 void setId (unsigned int id) ;
82 virtual void setMaxInstancePerBuffer (unsigned int value) ;
91 void setIsBuiltInShader (bool value) ;
97 void setDirtyInstanceData (bool value) ;
98
104 virtual bool load () override ;
108 virtual void unload () override ;
112 void reset () ;
113
114 // Constant buffers
122 ConstantBuffer* addConstantBuffer (unsigned int registerSlot, unsigned int space = 0) ;
128 ConstantBuffer* getConstantBuffer (unsigned int slot, unsigned int space = 0) const ;
136 void changeConstantBufferSlot (unsigned int fromSlot, unsigned int toSlot, unsigned int space = 0) ;
144 void changeConstantBufferSpace (unsigned int fromSpace, unsigned int toSpace, unsigned int slot) ;
151 void deleteConstantBuffer (unsigned int slot, unsigned int space = 0) ;
160 const ConstantBufferResourceDesc* getConstantBufferPerIndex (unsigned int index) const ;
161
162 // Textures
170 void addTexture (ShaderResource* texOrUav, unsigned int registerSlot, unsigned int space = 0) ;
176 ShaderResource* getTexture (unsigned int slot, unsigned int space = 0) const ;
184 void setTexture (ShaderResource* texOrUav, unsigned int slot, unsigned int space = 0) ;
192 void changeTextureSlot (unsigned int fromSlot, unsigned int toSlot, unsigned int space = 0) ;
200 void changeTextureSpace (unsigned int fromSpace, unsigned int toSpace, unsigned int slot) ;
207 void forgetTexture (unsigned int slot, unsigned int space = 0) ;
216 const ShaderResourceDesc* getTexturePerIndex (unsigned int index) const ;
217
218 // Samplers
226 void addSampler (Sampler* sampler, unsigned int registerSlot, unsigned int space = 0) ;
232 Sampler* getSampler (unsigned int slot, unsigned int space = 0) const ;
240 void setSampler (Sampler* sampler, unsigned int slot, unsigned int space = 0) ;
248 void changeSamplerSlot (unsigned int fromSlot, unsigned int toSlot, unsigned int space = 0) ;
256 void changeSamplerSpace (unsigned int fromSpace, unsigned int toSpace, unsigned int slot = 0) ;
263 void forgetSampler (unsigned int slot, unsigned int space = 0) ;
272 const SamplerResourceDesc* getSamplerPerIndex (unsigned int index) const ;
273
274 // UAV
282 void addUavBuffer (Buffer* buffer, unsigned int registerSlot, unsigned int space = 0) ;
288 Buffer* getUavBuffer (unsigned int slot, unsigned int space = 0) const ;
296 void setUavBuffer (Buffer* buffer, unsigned int slot, unsigned int space = 0) ;
304 void changeUavBufferSlot (unsigned int fromSlot, unsigned int toSlot, unsigned int space = 0) ;
312 void changeUavBufferSpace (unsigned int fromSpace, unsigned int toSpace, unsigned int slot = 0) ;
319 void forgetUavBuffer (unsigned int slot, unsigned int space = 0) ;
328 const UavResourceDesc* getUavBufferPerIndex (unsigned int index) const ;
329
330 // Instance data
337 virtual ShaderInstanceMemorySlot* addInstanceMemorySlot () ;
344 virtual ShaderInstanceMemorySlot* getInstanceMemorySlot (unsigned int index) ;
352 virtual ShaderInstanceMemorySlot* getInstanceMemorySlotReadOnly (unsigned int index) const ;
359 virtual void changeInstanceMemorySlotOrder (unsigned int fromIndex, unsigned int toIndex) ;
365 virtual void deleteInstanceMemorySlot (unsigned int index) ;
372 bool hasInstanceSlotSemanticName (nkMemory::StringView name) const ;
373
374 // Import / export
375 virtual void exportClassToTree (nkExport::Node* rootNode) override ;
376 virtual void importClassFromTree (nkExport::Node* rootNode) override ;
377
378 public :
379
380 // Statics
388 static nkMemory::UniquePtr<Shader> create (System* system = nullptr) ;
389 } ;
390 }
nkGraphics::Shader::changeInstanceMemorySlotOrder
virtual void changeInstanceMemorySlotOrder(unsigned int fromIndex, unsigned int toIndex)
nkGraphics::Shader::getDirtyInstanceData
bool getDirtyInstanceData() const
nkGraphics::Shader::unload
virtual void unload() override
nkGraphics::Shader::isUsableRaytracing
bool isUsableRaytracing() const
nkGraphics::Program
Holds all informations related to GPU programs, and manages their compilation.
Definition: Program.h:14
nkGraphics::Shader::addSampler
void addSampler(Sampler *sampler, unsigned int registerSlot, unsigned int space=0)
nkGraphics::Shader::changeTextureSpace
void changeTextureSpace(unsigned int fromSpace, unsigned int toSpace, unsigned int slot)
nkGraphics::Shader::setProgram
virtual void setProgram(Program *prog)
nkGraphics::System
Main interface with the component system.
Definition: System.h:14
nkGraphics::Shader::changeUavBufferSpace
void changeUavBufferSpace(unsigned int fromSpace, unsigned int toSpace, unsigned int slot=0)
nkGraphics::Shader::getSampler
Sampler * getSampler(unsigned int slot, unsigned int space=0) const
nkGraphics::Shader::getConstantBufferPerIndex
const ConstantBufferResourceDesc * getConstantBufferPerIndex(unsigned int index) const
nkGraphics::Shader::deleteInstanceMemorySlot
virtual void deleteInstanceMemorySlot(unsigned int index)
nkGraphics::ShaderBoundResourceDesc
Holds information about a resource linked in a shader for feeding.
Definition: ShaderResourceDesc.h:13
nkGraphics::Shader::setTexture
void setTexture(ShaderResource *texOrUav, unsigned int slot, unsigned int space=0)
nkExport::Exportable
An interface to define objects that can be exported using this component.
Definition: Exportable.h:15
nkGraphics::Shader::changeUavBufferSlot
void changeUavBufferSlot(unsigned int fromSlot, unsigned int toSlot, unsigned int space=0)
nkGraphics::Shader::changeTextureSlot
void changeTextureSlot(unsigned int fromSlot, unsigned int toSlot, unsigned int space=0)
nkGraphics::Buffer
A buffer that will reside on the GPU.
Definition: Buffer.h:17
nkGraphics::Shader::addInstanceMemorySlot
virtual ShaderInstanceMemorySlot * addInstanceMemorySlot()
nkGraphics::Shader::setUavBuffer
void setUavBuffer(Buffer *buffer, unsigned int slot, unsigned int space=0)
nkGraphics::Shader::hasInstanceSlotSemanticName
bool hasInstanceSlotSemanticName(nkMemory::StringView name) const
nkGraphics::Shader::forgetSampler
void forgetSampler(unsigned int slot, unsigned int space=0)
nkGraphics::Shader::setMaxInstancePerBuffer
virtual void setMaxInstancePerBuffer(unsigned int value)
nkGraphics::Shader::changeConstantBufferSlot
void changeConstantBufferSlot(unsigned int fromSlot, unsigned int toSlot, unsigned int space=0)
nkGraphics::Shader::getInstanceMemorySlotReadOnly
virtual ShaderInstanceMemorySlot * getInstanceMemorySlotReadOnly(unsigned int index) const
nkGraphics::Shader::getConstantBuffer
ConstantBuffer * getConstantBuffer(unsigned int slot, unsigned int space=0) const
nkGraphics::Shader::getInstanceMemorySlot
virtual ShaderInstanceMemorySlot * getInstanceMemorySlot(unsigned int index)
nkGraphics::Shader::forgetTexture
void forgetTexture(unsigned int slot, unsigned int space=0)
nkGraphics::Shader::changeConstantBufferSpace
void changeConstantBufferSpace(unsigned int fromSpace, unsigned int toSpace, unsigned int slot)
nkGraphics::Shader
A shader class, feeding data to a Program.
Definition: Shader.h:16
nkGraphics::Shader::getSamplerPerIndex
const SamplerResourceDesc * getSamplerPerIndex(unsigned int index) const
nkGraphics::Shader::setDirtyInstanceData
void setDirtyInstanceData(bool value)
nkGraphics::Shader::setIsBuiltInShader
void setIsBuiltInShader(bool value)
nkGraphics::Shader::getMaxInstancePerBuffer
unsigned int getMaxInstancePerBuffer() const
nkGraphics::Shader::getProgram
Program * getProgram() const
nkGraphics::Shader::isUsableGeometry
bool isUsableGeometry() const
nkGraphics::Shader::importClassFromTree
virtual void importClassFromTree(nkExport::Node *rootNode) override
nkGraphics::Shader::deleteConstantBuffer
void deleteConstantBuffer(unsigned int slot, unsigned int space=0)
nkExport::Node
A node in the tree structure representing the data to export / import.
Definition: Node.h:42
nkGraphics::Shader::setId
void setId(unsigned int id)
nkGraphics::Shader::exportClassToTree
virtual void exportClassToTree(nkExport::Node *rootNode) override
nkGraphics::Shader::getIsBuiltInShader
bool getIsBuiltInShader() const
nkGraphics::Shader::setSampler
void setSampler(Sampler *sampler, unsigned int slot, unsigned int space=0)
nkGraphics::Shader::addTexture
void addTexture(ShaderResource *texOrUav, unsigned int registerSlot, unsigned int space=0)
nkGraphics::Shader::reset
void reset()
nkMemory::UniquePtr
Smart pointer owning the object instance it encapsulates.
Definition: UniquePtr.h:17
nkGraphics::Shader::create
static nkMemory::UniquePtr< Shader > create(System *system=nullptr)
nkGraphics::Shader::getUavBuffer
Buffer * getUavBuffer(unsigned int slot, unsigned int space=0) const
nkMemory::StringView
Class holding information about a string, with no ownership over the data.
Definition: StringView.h:22
nkGraphics::Sampler
Holds all the information needed of a sampler used during rendering.
Definition: Sampler.h:14
nkGraphics::Shader::addUavBuffer
void addUavBuffer(Buffer *buffer, unsigned int registerSlot, unsigned int space=0)
nkGraphics::Resource
Base class for a resource in the component.
Definition: Resource.h:12
nkGraphics::Shader::isUsableScene
bool isUsableScene() const
nkGraphics::Shader::changeSamplerSpace
void changeSamplerSpace(unsigned int fromSpace, unsigned int toSpace, unsigned int slot=0)
nkGraphics::Shader::isUsablePostProcess
bool isUsablePostProcess() const
nkGraphics::Shader::isUsableCompute
bool isUsableCompute() const
nkGraphics::Shader::addConstantBuffer
ConstantBuffer * addConstantBuffer(unsigned int registerSlot, unsigned int space=0)
nkGraphics::Shader::forgetUavBuffer
void forgetUavBuffer(unsigned int slot, unsigned int space=0)
nkGraphics::Shader::getTexturePerIndex
const ShaderResourceDesc * getTexturePerIndex(unsigned int index) const
nkGraphics::Shader::getUavBufferPerIndex
const UavResourceDesc * getUavBufferPerIndex(unsigned int index) const
nkGraphics
Encompasses all API of component NilkinsGraphics.
Definition: BoundingBox.h:7
nkGraphics::ConstantBuffer
Describes a constant buffer.
Definition: ConstantBuffer.h:12
nkGraphics::Shader::~Shader
virtual ~Shader()
nkGraphics::Shader::getId
unsigned int getId() const
nkGraphics::Shader::getTexture
ShaderResource * getTexture(unsigned int slot, unsigned int space=0) const
nkGraphics::ShaderInstanceMemorySlot
A memory slot for per instance data in a Shader.
Definition: ShaderInstanceMemorySlot.h:14
nkGraphics::Shader::load
virtual bool load() override
nkGraphics::Shader::changeSamplerSlot
void changeSamplerSlot(unsigned int fromSlot, unsigned int toSlot, unsigned int space=0)
nkGraphics::ShaderResource
Base class for shader resources. Those are resources that can be fed to a Shader.
Definition: ShaderResource.h:12